package com.jhy.move;

/**
 * @Description:
 * @authoer:jihaiyu
 * @date: 2017/6/20 14:26
 */
public class Test {
    public static void main(String[] args) {
        int number = 10;
        //原始数二进制
        printInfo(number);
        number = number << 2;
        //左移一位
        printInfo(number);

        number = number >> 1;
        //右移一位
        printInfo(number);

        number = number >> 1;
        printInfo(number);

        int hash = hash("123");
        System.out.println("123".hashCode());
        System.out.println(hash);

    }

    /**
     * 输出一个int的二进制数
     *
     * @param num
     */
    private static void printInfo(int num) {
        System.out.println(Integer.toBinaryString(num));
    }

    static final int hash(Object key) {
        int h;
        return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16);
    }
}
